/**
* 作者: clz
* 日期: 2025-06-05 20:22:27
* 备注: 好友聊天消息
*/
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.protocol.Common;
import com.motu.monstercity.server.game.logic.ChatManager;
import com.motu.monstercity.server.game.logic.GameUser;
import com.motu.vertx.module.utility.toolset.TimeUtils;

public class ChatBuddy extends ChatBuddyModel {
	public ChatBuddy() {
		super();
	}

	/**
	 * 创建好友私聊对象
	 * @param userInfo
	 * @param subType
	 * @param receiveId
	 * @param msg
	 * @param param
	 */
	public ChatBuddy(UserInfo userInfo, int subType, long receiveId, String msg, String param) {
		long userId = userInfo.getId();
		if(userInfo != null) {
			putUserId(userId);
		}
		putUserJointId(ChatManager.getUserJointId(userId,receiveId));
		putSubType(subType);
		putReceiveId(receiveId);
		putContent(msg);
		putAddTime(TimeUtils.getCurTime());
		putParam(param);
		putIsRead(ChatManager.CHAT_IS_READ_NO);
	}

	/**
	 * 构建聊天下发格式
	 * @return
	 */
	public Common.PBChatMsg.Builder takeBuilder(){
		return ChatManager.takeChatMsgBuilder(getUserId(),getId(),ChatManager.CHAT_TYPE_BUDDY,getSubType(),getContent(),getAddTime(),getParam());
	}
}
